package com.maishi.programmer.jainzhioffer;

/**
 * Created by brossdong on 2018/5/5.
 * 高效实现单例模式
 * 1)静态内部类
 * 2)懒汉式加载
 */
public class TestProblem2 {

    /**
     * 静态内部类
     */
    /*public static class Sigleton {
        private static TestProblem2 instance = new TestProblem2();
    }
    public static TestProblem2 getInstance () {
        return Sigleton.instance;
    }*/

    /**
     *
     */
    public static TestProblem2 instance;
    private TestProblem2(){};
    public static TestProblem2 getInstance () {
        if (instance == null) {
            instance = new TestProblem2();
        }
        return instance;
    }

}
